<title>项目详情</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="#(assets)/css/weui2.css"/>
<script src="#(assets)/js/zepto.min.js"></script>
<script src="#(assets)/js/fx.js"></script>
#@checkToken()
<script>
  $(function(){
        var $sliderTrack = $('#sliderTrack'),
            $sliderHandler = $('#sliderHandler'),
            $sliderValue = $('#sliderValue');
        var totalLen = $('#sliderInner').width(),
            startLeft = 0,
            startX = 0;
        $sliderHandler
            .on('touchstart', function (e) {
                startLeft = parseInt($sliderHandler.css('left')) * totalLen / 100;
                startX = e.changedTouches[0].clientX;
            })
            .on('touchmove', function(e){
                var dist = startLeft + e.changedTouches[0].clientX - startX,
                    percent;
                dist = dist < 0 ? 0 : dist > totalLen ? totalLen : dist;
                percent =  parseInt(dist / totalLen * 100);
                $sliderTrack.css('width', percent + '%');
                $sliderHandler.css('left', percent + '%');
                $sliderValue.text(percent);
                e.preventDefault();
            })
        ;
	  });    

	//$("#jindu"+item.demandId).animate({left:item.investProgress+'%'},1000);
	$(document).ready(function() 
	{
		var jindu=$("#investList_jd").html();
		$("#investList_jdt").animate({left:'50%'},1000);
	});
</script>
<style> 
	body{background:#f2f6f9 !important}
	body{font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif,"宋体";}
	li{list-style-type:none;}
	.weui-slider-track{background-color:#fa3048 !important;}
	.weui-slider{height:20px !important;}
	.weui-slider-handler{width:14px !important;height:14px !important;margin-top:-8px !important;border:2px solid #fa3048;}
</style>
<body bgcolor="#fff" style="margin:0px;color:#626262;">
	<img hidden id="yihuan" style="position:absolute;top:100px;right:20px;width:80px;" src="/assets/images/mobile/yihuan.png">
	<img hidden id="hkz" style="position:absolute;top:100px;right:20px;width:80px;" src="/assets/images/mobile/hkz.png">
	<img hidden id="daihuan" style="position:absolute;top:100px;right:20px;width:80px;" src="/assets/images/mobile/daihuan.png">
	<div align="center" style="width:100%;height:200px;background:#FFF">
		<div id="name" style="font-size:14px;color:#626262;height:50px;line-height:50px;"></div>
		<div style="font-size:40px;margin-top:-5px;height:60px;">
			<a id="rate" style="color:#fa3048"></a>
			<a style="font-size:14px;color:#fa3048">%</a>
			<a style="font-size:14px;color:#d9bc47" id="plus_rate"></a>
		</div>
		<div style="font-size:14px;color:#626262;margin-top:-10px;height:20px;">预期年化</div>
		<div align="center" style="font-size:14px;color:#626262;margin-top:0px;">
			<div align="center" style="height:60px;float:left;width:49%;margin-top:10px;border-right:1px solid #f0f0f0">
				<div style="margin-top:10px;"><a id="amount" style="color:#626262;"></a>元</div>
				<div style="margin-top:10px;">融资金额</div>
			</div>
			<div align="center" style="height:60px;float:left;width:49%;margin-top:10px;border-right:1px solid #f0f0f0">
				<div style="margin-top:10px;"><a id="day_limit" style="color:#626262"></a>天</div>
				<div style="margin-top:10px;">投资期限</div>
			</div>
		</div>
	</div>
	<div align="center" style="background:#FFF;border-top:1px solid #f0f0f0;height:50px">
		<div align="center" style="font-size:14px;float:left;width:49%;margin-top:15px;">
			投资进度 <a id="jindu" style="color:#fa3048"></a>
		</div>
		<div align="center" style="font-size:14px;float:right;width:49%;margin-top:15px;">
			剩余可投 <a id="shengyu" style="color:#fa3048"></a>
		</div> 
	</div>
	<!--
	<div align="center" style="clear:both;height:45px;background:#f2f6f9">
		<img style="height:18px;margin-top:15px" src="/assets/images/mobile/investDetail_yhcg.png">
	</div> 
	-->
	<div align="center" style="width:100%;height:45px;background:#FFF;margin-top:5px;padding:5px 0 0 0;">
		<div id="loanerinfor"  style="width:100%;border-bottom:1px solid #eee;height:45px;line-height:45px;">
			<div style="width:90%">
				<div align="left" style="width:25%;float:left">活动信息</div>
				<div align="right" style="width:75%;float:left"><img style="height:15px;margin-top:15px;" src="/assets/images/mobile/jiantou.png"></div>
			</div>
		</div>
		
	</div>
	<div style="position:fixed;bottom:0;height:40px;background:#FFF;width:100%">
		<div style="float:left;line-height:40px;font-size:12px;float:left;width:33.3%"> 
			<img style="height:13px;margin:12px 0 0 20px;float:left" src="/assets/images/mobile/investDetail_ptsh.png"/> 
			<span style="float:left;margin-left:5px;">平台审核</span>
		</div>
		<div style="float:left;line-height:40px;font-size:12px;float:left;width:33.3%"> 
			<img style="height:13px;margin:12px 0 0 10px;float:left" src="/assets/images/mobile/investDetail_yhcg 2.png"/> 
			<span style="float:left;margin-left:5px;">资金托管</span>
		</div>
		<div style="float:left;line-height:40px;font-size:12px;float:left;width:33.3%"> 
			<img style="height:13px;margin:12px 0 0 10px;float:left" src="/assets/images/mobile/investDetail_zsxx.png"/> 
			<span style="float:left;margin-left:5px;">真实信息</span>
		</div>
	</div>
	<div align="center" style="margin-top:20px;"> 
		<span style="font-size:12px;">温馨提示：体验标投资每次仅限使用一张体验金券</span>
		<div id="touzi" style="height:50px;width:90%;background:#fa3048;border-radius:25px;line-height:50px;color:#FFF">
			<img id="investDetail_subimg" style="height:50px;float:left;margin-left:-1px;" src="/assets/images/mobile/investDetail_button1.png">
			<span id="subbutton" style="padding:10px 50px 10px 50px">立即投资</span>
		</div>
		<span style="font-size:12px;">市场有风险，投资需谨慎</span>
	</div> 
	
	<div id="investDetail_mengban" hidden  style="background-color:rgba(0,0,0,0.4);position:absolute;top:0;width:100%;height:100%;z-index:550"><div>
	<div align="center" hidden id="investDetail_jisuanqi" style="margin-left:5%;background:#FFF;height:180px;width:90%;position:absolute;top:150px;z-index:600;border-radius:10px;font-size:14px;">
		<div align="center" style="width:100%;line-height:49px;height:49px;border-bottom:1px solid #eee;font-size:16px;">
			<a style="color:#626262"> 计算收益</a>
		</div>
		<div align="center" style="width:100%;line-height:30px;height:80px;border-bottom:1px solid #eee">
			<div style="width:49%;height:80px;float:left;border-right:0px solid #eee;">
				<div>投资金额</div>
				<input id="amounts" placeholder="请输入金额" type="tel" style="border:1px solid #fa3048;width:80px;height:30px;font-size:13px;color:#fa3048;"> 元
			</div>
			<div id="riqi" style="width:49%;float:right">
				<div>投资期限</div>
				<div>30天</div>
			</div>
		</div>
		<div align="center" style="width:90%;line-height:49px;height:49px;">
			<span style="float:left">预期收益（元）</span>
			<span style="color:#fa3048;" id="shouyi">0.00</span>
		</div>
		<div align="center" style="width:90%;line-height:49px;height:49px;">
			<img style="width:40px;margin-top:10px;" src="#(assets)/images/investDetail_subimg.png" id="cha">
		</div>
	</div>
<script>
$(document).ready(function(){
	var id = GetRequest()["id"];
	var rates = 0;
	var amounts = 0;
	var times = 0;
	console.log(id);
	var url ="#(path)/bid/info?id="+id;
	$.getJSON(url, function(data) {
		var iteminfo = data.data.item;
		console.log(data);
		$("#name").html(iteminfo.name);
		$("#rate").html(iteminfo.rate);
		if(iteminfo.plus_rate!="0.0"){
			$("#plus_rate").html("+"+iteminfo.plus_rate+"%");
		}
		if(iteminfo.status=="repaying"){
			$("#daihuan").show();
			$("#investDetail_subimg").attr("src","/assets/images/mobile/investDetail_button11.png");
			$("#touzi").css("background","#626262");
		}else if(iteminfo.status=="waiting"){
			$("#daihuan").show();
			$("#investDetail_subimg").attr("src","/assets/images/mobile/investDetail_button11.png");
			$("#touzi").css("background","#626262");
		}else if(iteminfo.status=="finish"){
			$("#daihuan").show();
			$("#investDetail_subimg").attr("src","/assets/images/mobile/investDetail_button11.png");
			$("#touzi").css("background","#626262");
		}else if(iteminfo.status=="trading "){
			$("#subbutton").click(function(){
				window.location.href="#(path)/app/page/invest-investProm?id="+id;
			});
		}
		
		$("#amount").html(iteminfo.amount);
		$("#day_limit").html(iteminfo.day_limit);
		$("#unit_amount").html(iteminfo.unit_amount+"元/份");
		var jindu = (Number(iteminfo.avunit) * Number(iteminfo.unit_amount)*100/ Number(iteminfo.amount)).toFixed(2);
		$("#jindu").html(jindu+"%");	
		var shengyu = (Number(iteminfo.amount)/ Number(iteminfo.unit_amount)) - Number(iteminfo.avunit);
		$("#shengyu").html(shengyu + "元");
		rates = (Number(iteminfo.rate) + Number(iteminfo.plus_rate))/100;
		times = Number(iteminfo.day_limit);
		function shouyi(){
			amounts = $("#amounts").val();
			if(amounts == ""){
				amounts = 0;
			}
			var shouyi = (amounts * rates * times / 365).toFixed(2);
			$("#shouyi").html(shouyi);
		}
		//shouyi();
		setInterval(shouyi,500);
		$("#loanerinfor").click(function(){
			window.location.href="#(path)/app/page/invest-tasteactive?id="+id;
		});
		
		
		
		
		
	});
	
	function GetRequest() {   
	   var url = location.search; //获取url中"?"符后的字串  
	   var theRequest = new Object();  
	   if (url.indexOf("?") != -1) {  
		  var str = url.substr(1);  
		  strs = str.split("&");  
		  for(var i = 0; i < strs.length; i ++) {  
			 theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);  
		  }  
	   }  
	   return theRequest;  
	}  
	$("#investDetail_subimg").click(function(){
		  $("#investDetail_mengban").show();
		  $("#investDetail_jisuanqi").show();
	});
	$("#cha").click(function(){
		$("#investDetail_mengban").hide();
		$("#investDetail_jisuanqi").hide();
	});

	$("#investDetail_jiaxi").click(function(){
		$("#investDetail_jialist").toggle();
		var node=$('#investDetail_jialist');
		if(node.is(':hidden')){　　//如果node是隐藏的则显示node元素，否则隐藏
		　　$("#investDetail_jia").attr("src","#(assets)/images/mobile/personal_jiantou2.png");
		}else{
		　　$("#investDetail_jia").attr("src","#(assets)/images/mobile/personal_jiantou3.png");
		}			
	 
	});
	$("#investDetail_hongbao").click(function(){
		$("#investDetail_honglist").toggle();
		var node=$('#investDetail_honglist');
		if(node.is(':hidden')){　　//如果node是隐藏的则显示node元素，否则隐藏
		　　$("#investDetail_hong").attr("src","#(assets)/images/mobile/personal_jiantou2.png");
		}else{
		　　$("#investDetail_hong").attr("src","#(assets)/images/mobile/personal_jiantou3.png");
		}			
	
	});
});
</script>
	
	
	

	
</body>